import { Controller, Get } from '@nestjs/common'
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'
import { ApiSecurityAuth } from '~/common/decorators/swagger.decorator'
import { OSSCredentials } from '../interfaces/oss.interface'
import { OssService } from '../services/oss.service'

@ApiTags('Common - OSS服务')
@ApiSecurityAuth()
@Controller('common/oss')
export class OssController {
  constructor(private readonly ossService: OssService) {}

  @ApiOperation({ summary: '获取OSS临时凭证' })
  @ApiResponse({ status: 200, description: '获取成功' })
  @Get('credentials')
  async getCredentials(): Promise<OSSCredentials> {
    return this.ossService.getCredentials()
  }
}
